<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">
    <!-- BEGIN 全局样式 -->
    <link rel="stylesheet" href="../../../lib/bootstrap-3.3.7-dist/css/bootstrap.min.css" type="text/css"/>
    <link rel="stylesheet" href="../../../css/reset-diy.css" type="text/css">
    <title>预警设置</title>
    <style>
        .right-text{
            position: absolute;right: -17px;top: 8px;
        }
    </style>
</head>
<body>
<div class="container">

    <form id="formData" class="form-horizontal  mt-50 radius">
        <div class="mt-50">
            <div class="form-group">
                <label class="control-label col-sm-3">本周迟到</label>
                <div class="col-sm-6">
                    <input type="number" min="1" id="WEEK_LATER_TIMES" class="form-control" name="WEEK_LATER_TIMES"><span class="right-text">次</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-sm-3">本周早退</label>
                <div class="col-sm-6">
                    <input type="number" min="1" id="WEEK_LEAVE_EARLY_TIMES" class="form-control" name="WEEK_LEAVE_EARLY_TIMES"><span class="right-text">次</span>
                </div>
            </div>
            <!--甲乙丙丁戊己庚辛壬癸-->
            <div class="form-group">
                <label class="control-label col-sm-3">本周旷工</label>
                <div class="col-sm-6">
                    <input type="number" min="1" id="WEEK_ABSENTEEISM_TIMES" class="form-control" name="WEEK_ABSENTEEISM_TIMES"><span class="right-text">次</span>
                </div>
            </div>
            <!--子丑寅卯辰巳午未申酉戌亥-->
            <div class="form-group">
                <label class="control-label col-sm-3">以上考勤状态合计满</label>
                <div class="col-sm-6">
                    <input type="number" min="1" id="WEEK_BAD_TIMES" class="form-control" name="WEEK_BAD_TIMES"><span class="right-text">次</span>
                </div>
            </div>
        </div>
        <div class="mt-50">
            <div class="form-group">
                <label class="control-label col-sm-3">上周在岗时长不足</label>
                <div class="col-sm-6">
                    <input type="number" min="1" id="WEEK_WORK_TOTAL_TIME" class="form-control" name="WEEK_WORK_TOTAL_TIME"><span class="right-text">小时</span>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label col-sm-3"></label>
            <div class="col-sm-6">
                <button class="btn btn-primary btn-submit">提交</button>
                <button class="btn btn-danger ml-15" type="reset">重置</button>
            </div>
        </div>

    </form>


</div>

<!--核心脚本sss-->
<script src="../../../lib/jquery/1.9.1/jquery.js" type="text/javascript" charset="utf-8"></script>
<!--[if lt IE 9]>
<script src="../../../js/excanvas.min.js"></script>
<script src="../../../js/respond.min.js"></script>
<![endif]-->
<!--加密插件sss 必须放在jquery.myPlugIn_v1.0.js前面-->
<script src="../../../js/common/jsrsasign-all-min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/common/crypto-js.min.js" type="text/javascript" charset="utf-8"></script>
<!--加密插件eee-->

<!--<script src="../../../js/bootstrap.min.js" type="text/javascript"></script>-->
<script src="../../../lib/layer/2.4/layer.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="../../../lib/laypage/1.2/laypage.js" type="text/javascript" charset="utf-8"></script>-->
<script src="../../../js/work-box.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/common/jquery.myPlugIn_v1.0.js" type="text/javascript" charset="utf-8"></script>

<script>
    var T = new Extend_base();
    jQuery(document).ready(function () {
        function WarningCondition() {
            this.init();
        }

        WarningCondition.prototype = {
            init: function () {
                this.getConfig();
                this.submitEvent();
            },
            render: function (data) {
                $("#WEEK_LATER_TIMES").val(data.WEEK_LATER_TIMES||3);
                $("#WEEK_LEAVE_EARLY_TIMES").val(data.WEEK_LEAVE_EARLY_TIMES||3);
                $("#WEEK_ABSENTEEISM_TIMES").val(data.WEEK_ABSENTEEISM_TIMES||1);
                $("#WEEK_BAD_TIMES").val(data.WEEK_BAD_TIMES||3);
                $("#WEEK_WORK_TOTAL_TIME").val(data.WEEK_WORK_TOTAL_TIME||25);
            },
            getConfig: function () {
                var _this = this;
                T.ajaxSecret(url_join("setting/warning"), "post", {}, function (res) {
                    typeof res.data == "object" && _this.render(res.data);
                });
            },
            submitEvent: function () {
                var _this = this;
                $(".btn-submit").on("click", function (e) {
                    var data = {
                        setting: $("#formData").serializeObject()
                    };

                    T.ajaxSecret(url_join("setting/update"), "post", data, function (e) {
                        layer.msg("操作成功", {icon: 1});
                    });
                    e.preventDefault();
                });
            },

        };
        new WarningCondition();
    });
</script>
</body>
</html>